<template>
    <view class="inforamtion" style="display: flex;">
        <view >
            <view class="option" style="width: 520rpx;">
                <view class="lf">客户名称</view>
                <view class="rl">{{ filterMultiDictText(dictOptions['khdaId'], item.khdaId + '') }}</view>
            </view>
            <!-- <view class="option" style="width: 520rpx;" v-if="isFk">
                <view class="lf">是否为付款单位</view>
                <view class="rl">{{ filterMultiDictText(dictOptions['isFk'], item.isFk + '') }}</view>
            </view> -->
            <!-- <view class="option" style="width: 520rpx;">
                <view class="lf">是否为收款单位</view>
                <view class="rl"> {{ filterMultiDictText(dictOptions['isSk'], item.isSk + '') }}</view>
            </view> -->
              <template v-if="signSealWay == 'online'">
                  <view class="option" style="width: 520rpx;">
                      <view class="lf">对方是否电子签章</view>
                      <view class="rl"> {{ filterMultiDictText(dictOptions['isSignSeal'], item.isSignSeal + '') }}</view>
                  </view>
                  <view class="option" style="width: 520rpx;" v-if="item.isSignSeal && item.isSignSeal == 1">
                      <view class="lf">对方盖章人</view>
                      <view class="rl"> {{ item.psnName }}</view>
                  </view>
                  <view class="option" style="width: 520rpx;" v-if="item.isSignSeal && item.isSignSeal == 1">
                      <view class="lf">联系方式</view>
                      <view class="rl"> {{ item.psnMobile }}</view>
                  </view>
              </template>
              <!-- <template v-else-if="!isFk && signSealWay == 'online'">
                  <view class="option" style="width: 520rpx;">
                      <view class="lf">我方经办人</view>
                      <view class="rl"> {{ item.psnName }}</view>
                  </view>
                  <view class="option" style="width: 520rpx;">
                      <view class="lf">联系方式</view>
                      <view class="rl"> {{ item.psnMobile }}</view>
                  </view>
              </template> -->
        </view>
        <view  style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
            <u-icon name="edit-pen-fill" color="#2979ff" size="20" @click="handleEidtForm(item)"></u-icon>
            <u-line  direction="col" length="20" margin="0 10rpx"></u-line>
            <u-icon name="trash-fill" color="#2979ff" size="20" @click="handleRemoveForm(item)"></u-icon>
        </view>
    </view>
  </template>
  
  <script>
  import { filterMultiDictText, initDictOptions } from '@/utils/JDictSelectUtil.js'
  export default {
    name: 'FormAInfo',
    props: {
      index: {
        type: Number,
        default: null,
      },
          // 用印类型 电子签章 - 实体用印
          signSealWay: {
              type: [String, Number],
              default: '',
              required: false
          },
      item: {
        type: Object,
        default: () => ({}),
      },
          isFk: {
              type: Boolean,
              default: true,
          }
    },
    data () {
      return {
          filterMultiDictText,
          initDictOptions,
          dictOptions: {},
      }
    },
    watch: {
          item:{
              handler (val) {
                  if (val) {
                      this.initDictConfig()
                  }
              },
              immediate: true,
              deep: true
          }
    },
    methods: {
        initDictConfig() {
            initDictOptions('erp_purchase_supplier, enterprise_name,id').then((res) => {
                if (res.success) {
                    this.$set(this.dictOptions, 'khdaId', res.result)
                }
            })
            initDictOptions('yes_no').then((res) => {
                if (res.success) {
                    this.$set(this.dictOptions, 'isFk', res.result)
                    this.$set(this.dictOptions, 'isSk', res.result)
                    this.$set(this.dictOptions, 'isSignSeal', res.result)
                }
            })
        },
      handleCopyForm(item) {
        this.$emit('copy', [item, this.index])
      },
      handleEidtForm(item) {
        this.$emit('edit', [item, this.index])
      },
      handleRemoveForm(item) {
              uni.showModal({
                content: '确定删除吗？',
                success: (res) => {
                  if (res.confirm) {
                    this.$emit('remove', item)
                  }
                },
              })
      },
    },
  }
  </script>
  
  <style scoped lang="scss">
      .inforamtion{
          margin-top: 10rpx;
          padding: 10rpx;
          border-radius: 15rpx;
          box-shadow: 0px 4px 20px 0px rgba(0,0,0,0.1);
      }
  </style>
  